/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Entidades;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author USUARIO
 */
@Entity
@Table(name = "efectivo")
@NamedQueries({
    @NamedQuery(name = "Efectivo.findAll", query = "SELECT e FROM Efectivo e")})
public class Efectivo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "nro_transaccion")
    private Integer nroTransaccion;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Basic(optional = false)
    @Column(name = "cotizacion_alpago")
    private BigDecimal cotizacionAlpago;
    @JoinColumn(name = "moneda", referencedColumnName = "id_moneda")
    @ManyToOne
    private Moneda moneda;
    @JoinColumn(name = "nro_transaccion", referencedColumnName = "nro_transaccion", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Pago pago;

    public Efectivo() {
    }

    public Efectivo(Integer nroTransaccion) {
        this.nroTransaccion = nroTransaccion;
    }

    public Efectivo(Integer nroTransaccion, BigDecimal cotizacionAlpago) {
        this.nroTransaccion = nroTransaccion;
        this.cotizacionAlpago = cotizacionAlpago;
    }

    public Integer getNroTransaccion() {
        return nroTransaccion;
    }

    public void setNroTransaccion(Integer nroTransaccion) {
        this.nroTransaccion = nroTransaccion;
    }

    public BigDecimal getCotizacionAlpago() {
        return cotizacionAlpago;
    }

    public void setCotizacionAlpago(BigDecimal cotizacionAlpago) {
        this.cotizacionAlpago = cotizacionAlpago;
    }

    public Moneda getMoneda() {
        return moneda;
    }

    public void setMoneda(Moneda moneda) {
        this.moneda = moneda;
    }

    public Pago getPago() {
        return pago;
    }

    public void setPago(Pago pago) {
        this.pago = pago;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (nroTransaccion != null ? nroTransaccion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Efectivo)) {
            return false;
        }
        Efectivo other = (Efectivo) object;
        if ((this.nroTransaccion == null && other.nroTransaccion != null) || (this.nroTransaccion != null && !this.nroTransaccion.equals(other.nroTransaccion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.Efectivo[ nroTransaccion=" + nroTransaccion + " ]";
    }
    
}
